package jsyf.oa.dao.pm;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import jsyf.oa.entity.pm.ProjectEntity;
import jsyf.oa.entity.pm.ProjectPlanEntity;
import jsyf.oa.idao.BaseDao;
import jsyf.oa.ientity.IBaseEntity;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author: wangmin
 * @date: 2018/10/15 10:57
 */
@Repository
public class ProjectPlanDao extends BaseDao {
    public Integer batchAddPlan(List<JSONObject> jsonObjectList){
        StringBuilder sbSql=new StringBuilder();
        Integer result = 0;
        for (JSONObject jsonObject: jsonObjectList) {
            result += this.add(convertJson2Entity(jsonObject));
        }
        return result;
    }
    @Override
    public IBaseEntity convertJson2Entity(JSONObject json) {
        return JSON.toJavaObject(json, ProjectPlanEntity.class);
    }
}
